package com.cnap.model.schedule;

import com.cnap.model.schedule.engine.DeployPolicyRequest;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;

/**
 * <类文件描述>
 *
 * @author xc
 **/
public class StrategyDTO {
    // 服务id
    @ApiModelProperty(value = "服务id")
    @NotNull(message = "服务id不能为空")
    private String serviceId;
    // 策略名称
    @ApiModelProperty(value = "策略名称")
    @NotNull(message = "策略名称不能为空")
    private String strategyName;
    // 参数
    @ApiModelProperty(value = "参数")
    private String params;
    // 使用默认参数
    @ApiModelProperty(value = "是否使用默认参数")
    private int enableDefault;
    @ApiModelProperty(value = "是否强制隔离")
    private boolean forcedIsolation;
    @ApiModelProperty(value = "虚机扩缩容策略类型")
    private String scaleType;

    /**
     * get
     *
     * @return ScaleType
     */
    public String getScaleType() {
        return scaleType;
    }

    /**
     * set
     *
     * @param scaleType scaleType
     */
    public void setScaleType(String scaleType) {
        this.scaleType = scaleType;
    }

    /**
     * get
     *
     * @return ForcedIsolation
     */
    public boolean isForcedIsolation() {
        return forcedIsolation;
    }

    /**
     * set
     *
     * @param forcedIsolation forcedIsolation
     */
    public void setForcedIsolation(boolean forcedIsolation) {
        this.forcedIsolation = forcedIsolation;
    }

    /**
     * get
     *
     * @return ServiceId
     */
    public String getServiceId() {
        return serviceId;
    }

    /**
     * set
     *
     * @param serviceId serviceId
     */
    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    /**
     * get
     *
     * @return StrategyName
     */
    public String getStrategyName() {
        return strategyName;
    }

    /**
     * set
     *
     * @param strategyName strategyName
     */
    public void setStrategyName(String strategyName) {
        this.strategyName = strategyName;
    }

    /**
     * get
     *
     * @return Params
     */
    public String getParams() {
        return params;
    }

    /**
     * set
     *
     * @param params params
     */
    public void setParams(String params) {
        this.params = params;
    }

    /**
     * get
     *
     * @return EnableDefault
     */
    public int getEnableDefault() {
        return enableDefault;
    }

    /**
     * set
     *
     * @param enableDefault enableDefault
     */
    public void setEnableDefault(int enableDefault) {
        this.enableDefault = enableDefault;
    }

    /**
     * 转换成算法引擎的请求模型
     *
     * @return 请求
     */
    public DeployPolicyRequest toDeployPolicyRequest() {
        DeployPolicyRequest deployPolicyRequest = new DeployPolicyRequest();
        deployPolicyRequest.setServiceId(this.serviceId);
        deployPolicyRequest.setDeployPolicyConfig(this.params);
        deployPolicyRequest.setForcedIsolation(this.forcedIsolation);
        return deployPolicyRequest;
    }
}
